package com.example.maze;


public class Score {
	//place to store and get the stuff for the score table
	
	private int id;
	private int size;
	private int percent;
	private GameMode type;
	private int time; 
	private int moves;
	
	public Score(int id, int size, int percent, GameMode type, int time, int moves) {
		this.id = id;
		this.size = size;
		this.percent = percent;
		this.type = type;
		this.time = time;
		this.moves = moves;
	}
	
	public Score(int size, int percent, GameMode type, int time, int moves) {
		this.size = size;
		this.percent = percent;
		this.type = type;
		this.time = time;
		this.moves = moves;
	}
	
	public int getID(){
		return id;
	}
	
	public int getSize() {
		return size;
	}

	public int getPercent() {
		return percent;
	}

	public GameMode getType() {
		return type;
	}

	public int getTime() {
		return time;
	}

	public int getMoves() {
		return moves;
	}

	//figures out the score from the players details
	public double getScore(){
		double moveTime = type==GameMode.Timed ? time : moves;
		return((double) percent) * ((double) size) * (0.5*(1/moveTime));
	}
	
	public String getMoveTime() {
		if(type == GameMode.Timed){
			int mins = time / 60;
			int secs = time % 60;
			return (mins + ":" + String.format("%02d", secs));
		}
		return moves + "";
	}
	
}

